<template>
	<div class="layuimini-container">
		<div class="layuimini-main">
			<script type="text/html" id="toolbarDemo">
			    <div class="layui-btn-container">
			        <button  class="layui-btn layui-btn-sm layui-btn-danger data-delete-btn" lay-event="delete"> 清空 </button>
			    </div>
			</script>
			<table id="munu-table" class="layui-table" lay-filter="munu-table"></table>
			<script type="text/html" id="currentTableBar">
			    <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
			</script>
		</div>
	</div>
</template>

<script>
	import api from '@/api/system/log.js'
	export default {
		data(){
			return{
				list:{
				    "database": "db_tl_sale",
				    "flat": true,
				    "type": "mybatis",
				    "group": "base",
				    "host": "127.0.0.1",
				    "module": "sale",
				    "password": "123456",
				    "port": 3306,
				    "table": [
				        "t_xs_sale_contract"
				    ],
				    "username": "root"
				}
			}
		},
		created() {
			
			this.Loin()
		},
		methods:{
			Loin(){
				layui.use('table', function(){
				  let table = layui.table;
				  let data={
					  id:1
				  }
				  api.List(data).then(res=>{
					  table.render({
					    elem: '#munu-table'
					    ,height: 612
					    ,data: res
					    ,page: true 
						,toolbar: '#toolbarDemo'
					    ,cols: [[ //表头
					      {field: 'id', title: 'ID', width:200}
					      ,{field: 'description', title: '请求模块', width:180}
					      ,{field: 'browser', title: '请求方式', width:80, sort: true}
					      ,{field: 'requestIp', title: '请求人ip地址', width:160} 
						  ,{field: 'address', title: '链接地址', width: 90	}
					      ,{field: 'username', title: '请求人', width: 80}
						  ,{field: 'exceptionDetail', title: '报错信息', width: 167}
					      ,{field: 'time', title: '耗时', width: 80, sort: true,templet:function(data){
							  return data.time/100+"秒"
						  }}
					      ,{field: 'createTime', title: '时间', width: 180, sort: true}
					      ,{field: 'method', title: '状态', width: 100,templet:function(data){
							  return "<div class='el-tag el-tag--mini el-tag--"+(data.type===0?'success':'danger')+"' >"+data.logType+"</div>"
						  }}
					      ,{title: '操作', minWidth: 70, toolbar: '#currentTableBar', align: "center"}
					    ]]
					  });
				  })
				  
				})
			}
		}
	}
</script>

<style>
</style>
